<template>
  <div class="wft-w-h-100">
    <el-input
      v-model="vModelValue"
      :type="attrs.type"
      :maxlength="attrs.maxlength"
      :show-word-limit="attrs.showWordLimit"
      :placeholder="attrs.placeholder"
      :clearable="attrs.clearable"
      :show-password="attrs.password"
      :disabled="attrs.disabled"
      :readonly="attrs.readonly"
    />
  </div>
</template>
<script setup lang='ts'>
import { useAttrs, useTempValue } from 'generator/hooks'
import { ref, watch } from 'vue';

const props = defineProps<{
  panelJson: TPanel
  curComp: TComp
}>()

const vModelValue = ref('')

const attrs = useAttrs(props.curComp.attrs)

const value = useTempValue(attrs, props.curComp, props.panelJson)

watch(() => value, () => {
  vModelValue.value = value.value
}, { deep: true, immediate: true })
</script>
<style scoped>
.wft-w-h-100 {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}
</style>